/*     */ package com.qmsk.business.info.remindSettings.controller;
/*     */ 
/*     */ import com.qmsk.business.info.remindSettings.dao.RemindSetDAO;
/*     */ import com.utils.gson.in.GsonHeadOneRow;
/*     */ import com.utils.gson.out.GsonEbRst;
/*     */ import com.utils.jdbc.connection.DbConnection;
/*     */ import com.utils.web.RequestUtils;
/*     */ import com.utils.web.ResponseUtils;
/*     */ import java.sql.SQLException;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ import org.apache.log4j.Logger;
/*     */ import org.springframework.beans.factory.annotation.Autowired;
/*     */ import org.springframework.stereotype.Controller;
/*     */ import org.springframework.transaction.annotation.Transactional;
/*     */ import org.springframework.web.bind.annotation.PathVariable;
/*     */ import org.springframework.web.bind.annotation.RequestMapping;
/*     */ 
/*     */ @Controller
/*     */ @RequestMapping({"/remindSet"})
/*     */ public class RemindSetController
/*     */ {
/*  27 */   private static final Logger logger = Logger.getLogger(RemindSetController.class);
/*     */ 
/*     */   @Autowired
/*     */   private RemindSetDAO dao;
/*     */ 
/*     */   @RequestMapping(value={"find/vtId/{vtId}/{pageIdx}/{pageSize}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListOfVtId(HttpServletRequest request, HttpServletResponse response, @PathVariable("vtId") Integer vtId, @PathVariable("pageIdx") Integer nPageIdx, @PathVariable("pageSize") Short nPageSize)
/*     */   {
/*  36 */     nPageSize = RequestUtils.getRequestValidPageSize(nPageSize);
/*     */     try {
/*  38 */       GsonEbRst gsonEbRst = this.dao.getGsonOfVisitId(vtId, nPageIdx, nPageSize);
/*  39 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*     */     } catch (SQLException e) {
/*  41 */       logger.error(e);
/*  42 */       ResponseUtils.setErrorMsgResponse(
/*  43 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"find/all/{pageIdx}/{pageSize}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListOfAll(HttpServletRequest request, HttpServletResponse response, @PathVariable("pageIdx") Integer nPageIdx, @PathVariable("pageSize") Short nPageSize)
/*     */   {
/*  50 */     nPageSize = RequestUtils.getRequestValidPageSize(nPageSize);
/*     */     try {
/*  52 */       GsonEbRst gsonEbRst = this.dao.getGsonOfAll(nPageIdx, nPageSize);
/*  53 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*     */     } catch (SQLException e) {
/*  55 */       logger.error(e);
/*  56 */       ResponseUtils.setErrorMsgResponse(
/*  57 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"find/all/idName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListOfAllIdName(HttpServletRequest request, HttpServletResponse response) {
/*     */     try {
/*  64 */       GsonEbRst gsonEbRst = this.dao.getGsonOfAllIdName();
/*  65 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*     */     } catch (SQLException e) {
/*  67 */       logger.error(e);
/*  68 */       ResponseUtils.setErrorMsgResponse(
/*  69 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @Transactional
/*     */   @RequestMapping(value={"insert"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void insert(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/*  85 */     String sGsonInData = request.getParameter("data");
/*     */     try {
/*  87 */       int nResult = this.dao.insertJsonOneRow(sGsonInData);
/*  88 */       DbConnection.commit();
/*  89 */       ResponseUtils.setSqlResultResponse(nResult, 
/*  90 */         RequestUtils.getSqlInsertDataErrorMessage(request), 
/*  91 */         response);
/*     */     } catch (Exception e) {
/*  93 */       DbConnection.rollback();
/*  94 */       logger.error(e);
/*  95 */       ResponseUtils.setErrorMsgResponse(
/*  96 */         RequestUtils.getSqlInsertDataErrorMessage(request) + ":" + 
/*  97 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @Transactional
/*     */   @RequestMapping(value={"del"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void delete(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 113 */     String id = RequestUtils.getStringOfId(request);
/*     */     try {
/* 115 */       String[] strParams = id.split(",");
/* 116 */       int nResult = this.dao.deleteParams(strParams);
/* 117 */       ResponseUtils.setSqlResultResponse(nResult, 
/* 118 */         RequestUtils.getSqlDeleteDataErrorMessage(request), 
/* 119 */         response);
/* 120 */       DbConnection.commit();
/*     */     } catch (Exception e) {
/* 122 */       DbConnection.rollback();
/* 123 */       logger.error(e);
/* 124 */       ResponseUtils.setErrorMsgResponse(
/* 125 */         RequestUtils.getSqlDeleteDataErrorMessage(request) + ":" + 
/* 126 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @Transactional
/*     */   @RequestMapping(value={"edit"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void update(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 142 */     String id = request.getParameter("id");
/* 143 */     String sGsonInData = request.getParameter("data");
/*     */     try {
/* 145 */       GsonHeadOneRow g = GsonHeadOneRow.jsonStrToObject(sGsonInData);
/* 146 */       if (g == null) {
/* 147 */         ResponseUtils.setErrorMsgResponse(
/* 148 */           RequestUtils.getReadJsonDataErrorMessage(request), 
/* 149 */           response);
/*     */       } else {
/* 151 */         int nResult = this.dao.updateJsonOneRow(g, id);
/* 152 */         ResponseUtils.setSqlResultResponse(nResult, 
/* 153 */           RequestUtils.getSqlDeleteDataErrorMessage(request), 
/* 154 */           response);
/*     */       }
/* 156 */       DbConnection.commit();
/*     */     } catch (Exception e) {
/* 158 */       DbConnection.rollback();
/* 159 */       logger.error(e);
/* 160 */       ResponseUtils.setErrorMsgResponse(
/* 161 */         RequestUtils.getSqlDeleteDataErrorMessage(request) + ":" + 
/* 162 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\
 * Qualified Name:     com.qmsk.business.info.remindSettings.controller.RemindSetController
 * JD-Core Version:    0.5.3
 */